#include <stdlib.h>
#include <stdio.h>

int main()
{
    char* c1 = "1234";
    char* c2 = "1234a";

    char* endptr=NULL;

    unsigned int i = strtol(c1, &endptr, 10);
    i = strtol(c2, &endptr, 10);

    char* c3 = "0x1234";
    i = strtol(c3,NULL, 16);
    printf("%s to %d\n", c3, i);

    char* c4= "0xffffffff";
    i = strtol(c4, NULL, 16);
    printf("%ud \t %ud\n", i, 0xffffffff);

    unsigned short s = strtoll(c4, NULL, 16);
    printf("%us \t %us\n", s, 0xffff);

    printf("short size = %d\n", sizeof(short));
    printf("int size = %d\n", sizeof(int));
    printf("long int size = %d\n", sizeof(long int));
    printf("long long int size = %d\n", sizeof(long long int));
    
    char* c5="";
    char* tmp=NULL;
    i = strtol(c5, &tmp, 10);
    printf("result = %d, tmp = %d\n", i, *tmp);

    return 0;
}
